<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
	<title>jQuery.AjaxFilter</title>
	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script>
	<script type="text/javascript" src="../jquery.ajaxFilter.js"></script>
	<script type="text/javascript">
		function safeAjax(){
			jQuery.ajax({
				dataType:'script',
				url:'bad_script.js',
				filter:'alert'
			});
		};
		function unsafeAjax(){
			jQuery.ajax({
				dataType: 'script',
				url: 'bad_script.js'
			});
		};
		
		jQuery.ajaxFilter.register('alert', 'script', function( data ){
			return data.replace(/alert\(.+?\);?/g, '');
		});
	</script>
</head>
<body>	
	<button onclick="safeAjax()">Ajax with filter</button><button onclick="unsafeAjax()">Ajax without filter</button>
	<ul id="logs"></ul>
</body>
</html>
